import React,{Component} from 'react';
import {
    Image,
    View,
    TouchableOpacity,
    Text, Dimensions, Platform, DeviceEventEmitter, Modal
} from 'react-native';
import {createStackNavigator,createBottomTabNavigator,createSwitchNavigator,createAppContainer} from 'react-navigation';
import StackViewStyleInterpolator from "react-navigation-stack/dist/views/StackView/StackViewStyleInterpolator";
import PlusBarButton from './PlusBarButton';
import HomeMaskView from './HomeMaskView';

import Launch from './src/launch/Launch';

import Home from './src/home/Home';
import Market from './src/market/Market';
import Discovery from './src/discovery/Discovery';
import Mine from './src/mine/Mine';
import TalkShow from './src/talkShow/TalkShow';

import Videoplayer from './src/home/Videoplayer';
import Videoopen from './src/home/Videoopen';
import Login from './src/login/Login';
import LoginInfo from './src/login/LoginInfo';
import CityList from './src/login/CityList';
import BindPhone from './src/login/BindPhone';

import ArticleDetail from './src/home/ArticleDetail';
import CommentDetail from './src/home/CommentDetail';
import ReputationDetail from './src/home/ReputationDetail';
import QADetail from './src/home/questionAnswer/QADetail';
import Complain from './src/home/Complain';

import SquareDetail from './src/home/square/SquareDetail';
import PublishSquare from './src/home/square/PublishSquare';
import Topic from './src/home/square/Topic';
import HotLook from './src/home/square/HotLook';
import PublishPost from './src/home/post/PublishPost';
import Imagezoom from './src/baseClass/Imagezoom'
import LookDetail from './src/home/square/LookDetail';
import SquareImagezoom from './src/home/square/SquareImagezoom';
import RecommendFriend from './src/home/square/RecommendFriend';
import AroundPOI from './src/home/square/AroundPOI';

import PublishQA from './src/home/questionAnswer/PublishQA';
import KeepAsking from './src/home/questionAnswer/KeepAsking';
import NoticeList from './src/home/notice/NoticeList';

import Myfriend from "./src/mine/Myfriend";
import MineEditinfo from "./src/mine/MineEditinfo";
import BaseScreen, {isIphoneX} from "./src/baseClass/BaseScreen";
import MineEdit from "./src/mine/MineEdit";
import ChooseAddress from "./src/mine/ChooseAddress";
import MoreSetting from "./src/mine/MoreSetting";
import JXStorage from "./src/toolManager/JXStorage";
import {Toast} from "./src/baseClass/Toast";
import Carverify from "./src/mine/verify/Carverify";
import Industryverify from "./src/mine/verify/Industryverify";
import Mediaverify from "./src/mine/verify/Mediaverify";
import Carverifyedit from "./src/mine/verify/Carverifyedit";
import Myfollowfans from "./src/mine/Myfollowfans";
import Chatmessage from "./src/mine/Chatmessage";
import SplashScreen from 'react-native-splash-screen';
import PrivacyPolicy from "./src/login/PrivacyPolicy";
import UserProtocol from "./src/login/UserProtocol";
import About from './src/mine/About';
import RootSiblings from 'react-native-root-siblings';
import Minemoney from "./src/mine/money/Minemoney";
import BalanceDetail from "./src/mine/money/BalanceDetail";
import MyFeedback from "./src/mine/MyFeedback";
import AccountBind from "./src/mine/AccountBind";
import MsgComments from "./src/home/message/MsgComments";
import MsgFans from "./src/home/message/MsgFans";
import MsgPriseShit from "./src/home/message/MsgPriseShit";
import MsgNotice from "./src/home/message/MsgNotice";
import Search from "./src/home/search/Search";
import SearchList from "./src/home/search/SearchList";
import VideoLocalopen from "./src/home/VideoLocalopen";
import MoneyCash from "./src/mine/money/MoneyCash";
import Evideodetail from "./src/home/Evideo/Evideodetail";
import Evideofullscreendetail from "./src/home/Evideo/Evideofullscreendetail";

import TalkDetail from './src/talkShow/TalkDetail';
import CashOutRecord from "./src/mine/money/CashOutRecord";
import Minemoneysuccess from "./src/mine/money/Minemoneysuccess";

export const {width, height} = Dimensions.get('window');

/*
export const AppStack = createStackNavigator(
    {
        Home:{
            screen:Home,
        },
        Square:{
            screen:Square,
        },
        Mine:{
            screen:Mine,
        }
    },
    {
        navigationOptions: {
            headerTintColor: '#4C4C4E',
            headerBackTitle: null,
            headerStyle: {
                backgroundColor: '#0687C2',
                //backgroundColor:'white',
                shadowOpacity: 0,
                elevation: 0,
                borderBottomWidth: 0,
            },
            headerTitleStyle: {
                fontSize: 18,
                color: 'black',
                alignSelf: 'center',
            },
        }
    }
)*/

export const LaunchStack = createStackNavigator(
    {
        Launch: {
            screen: Launch,
            navigationOptions: () => ({
                header: null,
            }),
        }
    },

)

// export const LoginStack = createStackNavigator(
//     {
//         Login: {
//             screen: Login,
//             navigationOptions: () => ({
//                 header: null,
//             }),
//         },
//         LoginInfo: {
//             screen: LoginInfo,
//             navigationOptions: {
//                 header: null,
//             },
//         },
//     },
//
// )

export const HomeStack = createStackNavigator(
    {
        Home:{
            screen:Home,
            navigationOptions:{
                title:'首页',
                header:null,
            }
        },
        Evideodetail: {
            screen: Evideodetail,
            navigationOptions: {
                header: null,
                gesturesEnabled:true,
            },
        },
        Evideofullscreendetail: {
            screen: Evideofullscreendetail,
            navigationOptions: {
                header: null,
                gesturesEnabled:true,
            },
        },
        Videoplayer: {
            screen: Videoplayer,
            navigationOptions: {
                header: null,
                gesturesEnabled:true,
            },
        },
        Videoopen: {
            screen: Videoopen,
            navigationOptions: {
                header: null,
                gesturesEnabled:true,
            },
        },
        VideoLocalopen: {
            screen: VideoLocalopen,
            navigationOptions: {
                header: null,
                gesturesEnabled:true,
            },
        },
        Login: {
            screen: Login,
            navigationOptions: {
                header: null,
                gesturesEnabled:true,
            },
        },
        LoginInfo: {
            screen: LoginInfo,
            navigationOptions: {
                header: null,
                gesturesEnabled:true,
            },
        },
        BindPhone: {
            screen: BindPhone,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        PrivacyPolicy: {
            screen: PrivacyPolicy,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        UserProtocol: {
            screen: UserProtocol,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        CityList: {
            screen: CityList,
            navigationOptions: {
                header: null,
                gesturesEnabled:true,
            },
        },
        ArticleDetail:{
            screen:ArticleDetail,
            navigationOptions:{
                header:null,
                headerBackTitle:null,
                gesturesEnabled:true,
            },

        },
        CommentDetail:{
            screen:CommentDetail,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        ReputationDetail:{
            screen:ReputationDetail,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        QADetail:{
            screen:QADetail,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        PublishSquare: {
            screen:PublishSquare,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Topic: {
            screen:Topic,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        AroundPOI: {
            screen:AroundPOI,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        SquareDetail: {
            screen:SquareDetail,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        HotLook: {
            screen : HotLook,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        RecommendFriend: {
            screen:RecommendFriend,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        PublishPost: {
            screen : PublishPost,
            navigationOptions:{
                // header:null,
                headerBackTitle:null,
                gesturesEnabled:true,
            }
        },
        Imagezoom: {
            screen: Imagezoom,
            navigationOptions: {
                header: null,
                headerBackTitle: null,
                gesturesEnabled:true,
            }
        },
        SquareImagezoom: {
            screen: SquareImagezoom,
            navigationOptions: {
                header: null,
                headerBackTitle: null,
                gesturesEnabled:true,
            }
        },
        LookDetail: {
            screen : LookDetail,
            navigationOptions:{
                header:null,
                gesturesEnabled:true,
            }
        },
        PublishQA: {
            screen: PublishQA,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        KeepAsking: {
            screen: KeepAsking,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        MineInfo:{
            screen:Mine,
            navigationOptions:{
                title:'自己',
                header:null,
                gesturesEnabled:true,
            }
        },
        Chatmessage: {
            screen: Chatmessage,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Myfollowfans: {
            screen: Myfollowfans,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Myfriend: {
            screen: Myfriend,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        MineEditinfo: {
            screen: MineEditinfo,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        MineEdit: {
            screen: MineEdit,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        ChooseAddress: {
            screen: ChooseAddress,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        MoreSetting: {
            screen: MoreSetting,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Carverify: {
            screen: Carverify,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Industryverify: {
            screen: Industryverify,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Mediaverify: {
            screen: Mediaverify,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Carverifyedit: {
            screen: Carverifyedit,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Minemoney: {
            screen: Minemoney,
            navigationOptions: {
                gesturesEnabled:true,
            },
        } ,
        BalanceDetail: {
            screen: BalanceDetail,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        MsgComments: {
            screen: MsgComments,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        MsgFans: {
            screen: MsgFans,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        MsgPriseShit: {
            screen: MsgPriseShit,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        MsgNotice: {
            screen: MsgNotice,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        NoticeList: {
            screen:NoticeList,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Search: {
            screen:Search,
            navigationOptions: {
                header: null,
                headerBackTitle: null,
                gesturesEnabled:true,
            },
        },
        SearchList: {
            screen:SearchList,
            navigationOptions: {
                header: null,
                headerBackTitle: null,
                gesturesEnabled:true,
            },
        },
        TalkDetail:{
            screen:TalkDetail,
            navigationOptions:{
                header:null,
            }
        },
        Complain:{
            screen:Complain,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        CashOutRecord:{
            screen:CashOutRecord,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Minemoneysuccess:{
            screen:Minemoneysuccess,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
    },
    {
        initialRouteName: "Home",
        navigationOptions: {
            headerTintColor: 'black',
            headerBackTitle: null,
            headerStyle: {
                //backgroundColor: '#0687C2',
                backgroundColor:'white',
                shadowOpacity: 0,
                elevation: 0,
                borderBottomWidth: 1,
            },
            headerTitleStyle: {
                fontSize: 17,
                color: '#696d7d',
                alignSelf: 'center',
            },
        },
        transitionConfig: () => ({
            screenInterpolator: StackViewStyleInterpolator.forHorizontal
        })

    },
)
HomeStack.navigationOptions = ({ navigation }) => {

    // console.log('home nav index'+navigation.state.index);

    if (navigation.state.index === 0) {
        DeviceEventEmitter.emit('RefreshMsgCount');
    }

    return {
        tabBarVisible: navigation.state.index === 0,
    };
};

export const TalkShowStack = createStackNavigator(
    {
        TalkShow:{
            screen:TalkShow,
            navigationOptions:{
                header:null,
            }
        },
        TalkDetail:{
            screen:TalkDetail,
            navigationOptions:{
                header:null,
            }
        },
        Myfriend: {
            screen: Myfriend,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        MineEditinfo: {
            screen: MineEditinfo,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        MineEdit: {
            screen: MineEdit,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        ChooseAddress: {
            screen: ChooseAddress,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        MoreSetting: {
            screen: MoreSetting,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Carverify: {
            screen: Carverify,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Industryverify: {
            screen: Industryverify,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Mediaverify: {
            screen: Mediaverify,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Carverifyedit: {
            screen: Carverifyedit,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Login: {
            screen: Login,
            navigationOptions: {
                header: null,
                gesturesEnabled:true,
            },
        },
        PrivacyPolicy: {
            screen: PrivacyPolicy,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        UserProtocol: {
            screen: UserProtocol,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        LoginInfo: {
            screen: LoginInfo,
            navigationOptions: {
                header: null,
                gesturesEnabled:true,
            },
        },
        BindPhone: {
            screen: BindPhone,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Myfollowfans: {
            screen: Myfollowfans,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        MineInfo:{
            screen:Mine,
            navigationOptions:{
                title:'自己',
                header:null,
                gesturesEnabled:true,
            }
        },
        Chatmessage: {
            screen: Chatmessage,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        ArticleDetail:{
            screen:ArticleDetail,
            navigationOptions:{
                header:null,
                headerBackTitle:null,
                gesturesEnabled:true,
            }
        },
        CommentDetail:{
            screen:CommentDetail,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        ReputationDetail:{
            screen:ReputationDetail,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        QADetail:{
            screen:QADetail,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        PublishSquare: {
            screen:PublishSquare,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        SquareDetail: {
            screen:SquareDetail,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        PublishPost: {
            screen : PublishPost,
            navigationOptions:{
                // header:null,
                headerBackTitle:null,
                gesturesEnabled:true,
            }
        },
        About: {
            screen: About,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Minemoney: {
            screen: Minemoney,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        MoneyCash: {
            screen: MoneyCash,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        BalanceDetail: {
            screen: BalanceDetail,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Videoplayer: {
            screen: Videoplayer,
            navigationOptions: {
                header: null,
                gesturesEnabled:true,
            },
        },
        Videoopen: {
            screen: Videoopen,
            navigationOptions: {
                header: null,
                gesturesEnabled:true,
            },
        },
        VideoLocalopen: {
            screen: VideoLocalopen,
            navigationOptions: {
                header: null,
                gesturesEnabled:true,
            },
        },
        MyFeedback: {
            screen: MyFeedback,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        AroundPOI: {
            screen:AroundPOI,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Topic: {
            screen:Topic,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        AccountBind: {
            screen:AccountBind,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Complain:{
            screen:Complain,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        CashOutRecord:{
            screen:CashOutRecord,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Minemoneysuccess:{
            screen:Minemoneysuccess,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
    },
    {
        initialRouteName: "TalkShow",
        navigationOptions: {
            headerTintColor: 'black',
            headerBackTitle: null,
            headerStyle: {
                //backgroundColor: '#0687C2',
                backgroundColor:'white',
                shadowOpacity: 0,
                elevation: 0,
                borderBottomWidth: 1,
            },
            headerTitleStyle: {
                fontSize: 17,
                color: '#696d7d',
                alignSelf: 'center',
            },
        },
        transitionConfig: () => ({
            screenInterpolator: StackViewStyleInterpolator.forHorizontal
        })
    }
)

TalkShowStack.navigationOptions = ({ navigation }) => {
    return {
        tabBarVisible: navigation.state.index === 0,
    };
};

export const MarketStack = createStackNavigator(
    {
        Market:{
            screen:Market,
            navigationOptions:{
                title:'商场',
            }
        }
    },
    {
        initialRouteName: "Market",
        navigationOptions: {
            headerTintColor: '#4C4C4E',
            headerBackTitle: null,
            headerStyle: {
                //backgroundColor: '#0687C2',
                backgroundColor:'white',
                shadowOpacity: 0,
                elevation: 0,
                borderBottomWidth: 0,
            },
            headerTitleStyle: {
                fontSize: 18,
                color: 'black',
                alignSelf: 'center',
            },
        }
    }
)

export const DiscoveryStack = createStackNavigator(
    {
        Discovery:{
            screen:Discovery,
            navigationOptions:{
                title:'发现',
            }
        }
    },
    {
        initialRouteName: "Discovery",
        navigationOptions: {
            headerTintColor: '#4C4C4E',
            headerBackTitle: null,
            headerStyle: {
                //backgroundColor: '#0687C2',
                backgroundColor:'white',
                shadowOpacity: 0,
                elevation: 0,
                borderBottomWidth: 0,
            },
            headerTitleStyle: {
                fontSize: 18,
                color: 'black',
                alignSelf: 'center',
            },
        }
    }
)

export const MineStack = createStackNavigator(
    {
        Mine:{
            screen:Mine,
            navigationOptions:{
                title:'自己',
                header:null,
            }
        },
        Myfriend: {
            screen: Myfriend,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        MineEditinfo: {
            screen: MineEditinfo,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        MineEdit: {
            screen: MineEdit,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        ChooseAddress: {
            screen: ChooseAddress,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        MoreSetting: {
            screen: MoreSetting,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Carverify: {
            screen: Carverify,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Industryverify: {
            screen: Industryverify,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Mediaverify: {
            screen: Mediaverify,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Carverifyedit: {
            screen: Carverifyedit,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Login: {
            screen: Login,
            navigationOptions: {
                header: null,
                gesturesEnabled:true,
            },
        },
        PrivacyPolicy: {
            screen: PrivacyPolicy,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        UserProtocol: {
            screen: UserProtocol,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        LoginInfo: {
            screen: LoginInfo,
            navigationOptions: {
                header: null,
                gesturesEnabled:true,
            },
        },
        BindPhone: {
            screen: BindPhone,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Myfollowfans: {
            screen: Myfollowfans,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        MineInfo:{
            screen:Mine,
            navigationOptions:{
                title:'自己',
                header:null,
                gesturesEnabled:true,
            }
        },
        Chatmessage: {
            screen: Chatmessage,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        ArticleDetail:{
            screen:ArticleDetail,
            navigationOptions:{
                header:null,
                headerBackTitle:null,
                gesturesEnabled:true,
            }
        },
        CommentDetail:{
            screen:CommentDetail,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        ReputationDetail:{
            screen:ReputationDetail,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        QADetail:{
            screen:QADetail,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        PublishSquare: {
            screen:PublishSquare,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        SquareDetail: {
            screen:SquareDetail,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        PublishPost: {
            screen : PublishPost,
            navigationOptions:{
                // header:null,
                headerBackTitle:null,
                gesturesEnabled:true,
            }
        },
        About: {
            screen: About,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Minemoney: {
            screen: Minemoney,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        MoneyCash: {
            screen: MoneyCash,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        BalanceDetail: {
            screen: BalanceDetail,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Videoplayer: {
            screen: Videoplayer,
            navigationOptions: {
                header: null,
                gesturesEnabled:true,
            },
        },
        Videoopen: {
            screen: Videoopen,
            navigationOptions: {
                header: null,
                gesturesEnabled:true,
            },
        },
        VideoLocalopen: {
            screen: VideoLocalopen,
            navigationOptions: {
                header: null,
                gesturesEnabled:true,
            },
        },
        MyFeedback: {
            screen: MyFeedback,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        AroundPOI: {
            screen:AroundPOI,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Topic: {
            screen:Topic,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        AccountBind: {
            screen:AccountBind,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        TalkDetail:{
            screen:TalkDetail,
            navigationOptions:{
                header:null,
            }
        },
        Complain:{
            screen:Complain,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        CashOutRecord:{
            screen:CashOutRecord,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
        Minemoneysuccess:{
            screen:Minemoneysuccess,
            navigationOptions: {
                gesturesEnabled:true,
            },
        },
    },
    {
        initialRouteName: "Mine",
        navigationOptions: {
            headerTintColor: '#4C4C4E',
            headerBackTitle: null,
            headerStyle: {
                //backgroundColor: '#0687C2',
                backgroundColor:'white',
                shadowOpacity: 0,
                elevation: 0,
                borderBottomWidth: 0,
            },
            headerTitleStyle: {
                fontSize: 18,
                color: 'black',
                alignSelf: 'center',
            },
        },
        transitionConfig: () => ({
            screenInterpolator: StackViewStyleInterpolator.forHorizontal
        })
    }
)
MineStack.navigationOptions = ({ navigation }) => {
    return {
        tabBarVisible: navigation.state.index === 0,
        tabBarOnPress:function () {
            // alert(123)
        }
    };
};


const TabBarNavigation = createBottomTabNavigator(
    {
        Home:{
            screen:HomeStack,
            /*navigationOptions:{
                tabBarLabel:'首页',
                tabBarIcon:({tintColor,focused}) => (

                    <Image style={{width:20,height:20}}
                           source={focused ? require('./resource/image/Home/tab_home_on.png') : require('./resource/image/Home/tab_home_off.png')} />
                )
            }*/
            navigationOptions:({ navigation }) => ({
                tabBarLabel:({tintColor,focused}) => (
                    <TouchableOpacity style={{width:'100%',height:'100%',alignItems:'center',justifyContent:'center'}} onPress={()=>{
                        // JXStorage.getToken(function (cb) {
                        //     console.log("token   "+cb);
                        //     // if (!cb){
                        //     //     navigation.navigate('Login',{callback:()=>{
                        //     //
                        //     //         }});
                        //     //     return
                        //     // }
                        //     navigation.navigate('Home')
                        //     DeviceEventEmitter.emit('homepage');
                        // })

                        navigation.navigate('Home');
                        DeviceEventEmitter.emit('homepage');

                        DeviceEventEmitter.emit('PauseVideo');

                        DeviceEventEmitter.emit('RefreshMsgCount');

                    }}>

                        <Image style={{width:20,height:20,marginTop:4}}
                               source={focused ? require('./resource/image/Home/tab_home_on.png') : require('./resource/image/Home/tab_home_off.png')} />
                        {focused ?<Text style={{fontSize:12,marginTop:7,color:'black'}}>首页</Text>:<Text style={{fontSize:12,marginTop:7,color:'#BDD8D8'}}>首页</Text>}
                    </TouchableOpacity>
                ),
            })
        },
        TalkShow:{
            screen:TalkShowStack,
            navigationOptions:{
                tabBarLabel:'E派胡言',
                tabBarIcon:({tintColor,focused}) => (

                    <Image style={{width:20,height:20}}
                           source={focused ? require('./resource/image/Home/tab_talk_on.png') : require('./resource/image/Home/tab_talk_off.png')} />
                )
            }
        },
        E:{
            screen:MarketStack,
            navigationOptions:({navigation}) => ({
                // tabBarLabel:'广场',
                // tabBarIcon:({tintColor,focused}) => (
                //     <View style={{width:25,height:25,backgroundColor:focused ? 'red' : 'black'}} />
                // ),

                tabBarButtonComponent:() => <PlusBarButton navigation={navigation}/>
            }),

        },
        // Discovery:{
        //     screen:DiscoveryStack,
        //     navigationOptions:{
        //         tabBarLabel:'发现',
        //         tabBarIcon:({tintColor,focused}) => (
        //             <Image style={{width:20,height:20}}
        //                    source={focused ? require('./resource/image/Home/tab_find_on.png') : require('./resource/image/Home/tab_find_off.png')} />
        //         )
        //     }
        // },
        Mine:{
            screen:MineStack,
            navigationOptions:({ navigation }) => ({
                tabBarLabel:({tintColor,focused}) => (
                    <TouchableOpacity style={{width:'100%',height:'100%',alignItems:'center',justifyContent:'center'}} onPress={()=>{
                        JXStorage.getToken(function (cb) {
                            console.log("token   "+cb);
                            if (!cb){
                                navigation.navigate('Login',{callback:()=>{

                                    }});
                                return
                            }
                            DeviceEventEmitter.emit('minepage');
                            navigation.navigate('Mine');

                            DeviceEventEmitter.emit('PauseVideo');
                        })
                    }}>

                        <Image style={{width:20,height:20,marginTop:4}}
                               source={focused ? require('./resource/image/Home/tab_owner_on.png') : require('./resource/image/Home/tab_owner_off.png')} />
                        {focused ?<Text style={{fontSize:12,marginTop:7,color:'black'}}>自己</Text>:<Text style={{fontSize:12,marginTop:7,color:'#BDD8D8'}}>自己</Text>}
                    </TouchableOpacity>
                ),
            })
        },
    },
    {
        tabBarOptions:{
            activeTintColor:'#070c29',
            inactiveTintColor:'#bad8d8',
            labelStyle:{
                fontSize:12,
            },
        },
        tabBarPosition:'bottom',
    },
)

const AppNavigator = createSwitchNavigator(
    {
        Launch:LaunchStack,
        TabBar:TabBarNavigation,
        // Login:LoginStack
    }
);

const AppContainer = createAppContainer(AppNavigator);

export default class Routers extends Component{
    constructor(props) {
        super(props);

        this.state = {
            eMenuVisible:false,
            modalVisible:false,
        }
    }

    componentDidMount() {
        // if (Platform.OS==='ios'){
        //     var a = 1;
        //     let that = this;
        //     this.timer = setInterval(function () {
        //         console.log("setTimeout=="+a);
        //         a++;
        //         if (a==3){
        //             SplashScreen.hide();
        //             that.timer && clearInterval(that.timer);
        //         }
        //     },1000);
        // }
    }
    render(): React.ReactNode {
        return (
                <AppContainer
                    ref={nav => {
                        this.navigator = nav;
                    }}
                />
    )

    }
}
